package com.ofd.sign.domin;

import cn.hutool.core.codec.Base64;
import lombok.Getter;
import lombok.Setter;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author wangrenjie
 */
@Getter
@Setter
public abstract class BaseSignReq<T> implements Serializable {

    //电子证照文件Base64内容
    @NotNull
    private String content;

    //签章模式
    @NotNull
    private String signMode;

    //自定义参数
    @Valid
    private T params;



    /**
     * 解码Base64文件
     *
     * @return
     */
    public byte[] fetchFile() {
        return Base64.decode(content);
    }
}
